<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Users
 *
 * @author Gloire
 */
class User extends AppModel{
    
    // On defini les regles de validation
    public $validate = array(
        'username' => array(
            array(
                'rule' => 'alphanumeric',
                'required' => true,
                'allowEmpty' => false,
                'message' => "Votre pseudo n'est pas valide"
            ),
            
            array(
                'rule' => 'isUnique',
                'message' => 'Ce pseudo est dejà pris'
            ),
        ),
        
        'mail' => array(
            array(
                'rule' => 'email',
                'required' => false,
                'allowEmpty' => false,
                'message' => "Votre email n'est pas valide"
            ),
            
            array(
                'rule' => 'isUnique',
                'message' => 'Cet email est dejà pris'
            ),
        ),
        
        'password' => array(
            array(
                'rule' => 'alphanumeric',
                'required' => true,
                'message' => "Vous devez entrer un mot de passe",
                'allowEmpty' => false
            )
        )
    );
}
